package com.nbcb.nwql.common.util;

import com.nbcb.nwql.common.rtnvo.ExceptionResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Component
@Slf4j
@RestControllerAdvice
public class GlowbalExceptionHandle {

    @ResponseStatus(HttpStatus.BAD_REQUEST)
    @ExceptionHandler({ArithmeticException.class})
    public ExceptionResponse handleArgException() {
        ExceptionResponse exceptionVo = new ExceptionResponse(500, "系统异常", "系统异常，请联系管理员");
        return exceptionVo;
    }

}
